PREFIX ?= /

CC ?= cc
AR ?= ar

INC += -I./include -I./common -I./render -I./Xext -I./lbx -I./fb\
       -I./mi -I./miext/shadow -I./hw/kdrive -I./miext/layer -I./os\
       -I/opt/X11/include 
CFLAGS += -Os -Wall
LDFLAGS = -static -Wl,--gc-sections,--sort-common,-s

LIBS := -L/opt/X11/lib -lXfont -lXinerama -lX11 -lXext -lX11 -lXdmcp -lz -lm

####NODEBUG####
NDEBUG=            -DNDEBUG
NOERROR=           -DNOERROR

####extensions####
DPMS =             -DDPMSExtension
SCREENSAVER =      -DSCREENSAVER
MIT-SHM =          -DMITSHM
RENDER =           -DRENDER
#FIXME:if not defined dont define PANORAMIX=-DPANORAMIX
SHAPE =            -DSHAPE
SYNC =             -DXSYNC
TOG-CUP =          -DTOGCUP
XCMISC =           -DXCMISC
XTEST =            -DXTEST
XTRAP =            -DXTRAP
XV =               -DXV
RANDR =            -DRANDR
XRECORD =          -DXRECORD
FONTCACHE =        -DNOFONTSERVERACCESS	# -DFONTCACHE or -DNOFONTSERVERACCESS

####internal####
ISCREENSAVER=      -DISCREENSAVER #saves about 3.2KB

####not working####
#XINPUT =         -DXINPUT	#NOT WORKING!
#XKB =            -DXKB/XKB_IN_SERVER=-DXKB	#NOT WORKING!


####others####
SERVER_LOCK =     -DSERVER_LOCK
SMART_SCHEDULE =  -DSMART_SCHEDULE
USE_RGB_TXT =     -DUSE_RGB_TXT
#XDMCP =          -DXDMCP
PANORAMIX =       -DPANORAMIX

####where to look for fonts/colors####
FONTPATH = $(PREFIX)/share/fonts/X11/misc/
RGB =      $(PREFIX)/share/X11/rgb

#all deactivated creates 543K Xvesa
#all activated creates 728K Xvesa
DEFS =\
	-Dlinux\
	-D_POSIX_SOURCE\
	-D_BSD_SOURCE\
	-DTOSHIBA_SMM\
	-D_SVID_SOURCE\
	-D_GNU_SOURCE\
	-DX_LOCALE\
	-DKDRIVESERVER\
	-DGCCUSESGAS\
	-DDDXOSINIT\
	-DNARROWPROTO\
	-DPIXPRIV\
	-DFUNCPROTO=15\
	-DCOMPILEDDEFAULTFONTPATH=\"${FONTPATH}\"\
	-DRGB_DB=\"${RGB}\"\
	-D_POSIX_C_SOURCE=2\
	-DXSERV_t\
	-DTRANS_SERVER\
	-DUNIXCONN\
	-DTCPCONN\
	-DHAS_FCHOWN\
	-DDDXOSINIT\
	-DBIGREQS\
	-D__KERNEL_STRICT_NAMES\
	$(NOERROR)\
	$(NDEBUG)\
	$(ISCREENSAVER)\
	$(FONTCACHE)\
	$(XTEST)\
	$(DPMS)\
	$(SYNC)\
	$(PANORAMIX)\
	$(SHAPE)\
	$(TOG-CUP)\
	$(MIT-SHM)\
	$(RENDER)\
	$(SCREENSAVER)\
	$(SERVER_LOCK)\
	$(SMART_SCHEDULE)\
	$(XCMISC)\
	$(XDMCP)\
	$(XTRAP)\
	$(XV)\
	$(XINPUT)\
	$(XKB)\
	$(XKB_IN_SERVER)\
	$(RANDR)\
	$(XRECORD)\
	$(USE_RGB_TXT)\
	$(PIXPRIV)\
	$(X_LOCALE)\
	$(XF86BIGFONT)\
	$(BIGREQS)
